package com.open.pokergames;

import com.open.pokergames.comm.repository.cache.LocalCache;
import com.sinothk.android.utils.XUtils;

import java.util.HashMap;

public class NetConfig {

        public static final String Ip = "192.168.3.19";
//    public static final String Ip = "192.168.0.15";
//    public static final String Ip = "192.168.0.63";
//    public static final String Ip = "101.34.162.114";

    public static final String PORT = "18092";//http://192.168.2.135:18092/pg/v10626/comm/login
    public static final String BASE_URL = "http://" + Ip + ":" + PORT + "/pg/";

    public static final String SOCKET_URL = Ip + ":" + PORT + "/pg/";

    /**
     * 构建服务请求头部信息
     */
    public static HashMap<String, String> getHeader() {
        HashMap<String, String> headerMap = new HashMap<>();
        String token = LocalCache.getToken();
        if (XUtils.string().isEmpty(token)) {
            return null;
        }
        headerMap.put("token", token);
        return headerMap;
    }

    public static String getImageUrl(String userAvatar) {
        // http://192.168.2.135:18092/pg/static/sys/avatar/1432936811591258114.png
        if (XUtils.string().isNotEmpty(userAvatar)) {
            return BASE_URL + "static/" + userAvatar;
        }
        return null;
    }

    public static String getAppUrl(String diskPath) {
        // http://101.34.162.114:18092/pg/static/sys/apps/dz_2.0_2_release.apk
        if (XUtils.string().isNotEmpty(diskPath)) {
            return BASE_URL + "static/" + diskPath;
        }
        return null;
    }
}
